¿
                                                                           
           ۿ ۿ ۿ   ۿ         ۿ ۿ ۿ     ۿ           
           ۳ ۳ ۿ ۳           ۳                
            ۳         ۿ    ۳   ۳     ۿ            
              ۳             ۳   ۳                 
             ۳   ۳ ۳         ۳     ۿ ۿ ۿ           
                                            
                      ۳
                                  ۳
                              ߳
                                                                             
ÿ               Written by Arnaud Carre. (leonard@mygale.org)               ڴ



	NEW: "YM3b" Format !!! See bellow...

	WARNING: YM4! format is changed !!!


	Many people asked me how to find new YM files. Well, the problem is
that it takes me too much time to convert new modules. Then I decide to give
you my YM-File format, so you can generate YM-File by yourself !



	As you probably know, YM is only an YM2149 Chip emulator, not a true
MC68000 emulator. (For the moment !). YM-Files does not contain any 68000
code routine. A music-file is composed of YM2149 registers generated by the
original play-routine for each 50th seconds. As the YM2149 has 14 registers
8 bits each, that means 14 bytes for 1/50 second, so 700 bytes for one
second of soundchip.

	When I convert an ATARI music, I play the music on the ATARI, and I
store YM2149 registers set each 1/50sec (Vertical Blank time, VBL) in a big
file as follow:

	VBL1:
		store reg0,reg1,reg2,...,reg12,reg13	(14 regs)
	VBL2:
		store reg0,reg1,reg2,...,reg12,reg13	(14 regs)


				..........


	VBLn:
		store reg0,reg1,reg2,...,reg12,reg13	(14 regs)


	The problem is that is takes a lot of disk-space. Just count: A 10
minutes song will take 420000 bytes on disk. But don't panic, the music are
compressed with LHARC method (using LHA program from Haruyasu Yoshizaki).
To reach best compression ratio, I store registers in a different order:


	VBL1 reg0, VBL2 reg0, VBL3 reg0 .... VBLn reg0

	VBL1 reg1, VBL2 reg1, VBL3 reg1 .... VBLn reg1


				..........


	VBL1 reg14,VBL2 reg14,VBL3 reg14.... VBLn reg14



        So, here is the old YM3 file format:


	Offset  Size  Name    Value   Comments
	0       4     ID      'YM3!'  File type Identificator.

	then YM2149 registers starts a offset 4.

	The number of used VBL for music can be computed as follow:

	nvbl = (ymfile_size-4)/14;


------------------------------------------------------------------------------
WARNING:
	The LHA compression must be called AFTER the file is generated. ALWAYS
	USE THE HEADER TYPE 0 when compressing (-h0).
	Ex: You just create your binary file, starting with 'YM3!' ID, then
	all YM registers. The music is 2 minutes long, that means your
	binary is 2*60*700 + 4 = 84004 bytes long. you must compress it before
	using the file with YM.EXE: (ex: your binary is TEST.BIN)

	LHA a -h0 TEST.LHA TEST.BIN

	Then a file TEST.LHA is created, wich is DIRECTLY a valid YM file.
	just type:

	ren test.lha test.ym

	Then you can hear the file with YM.EXE

        (I use LHA.EXE v2.13).
------------------------------------------------------------------------------


------------------------------------------------------------------------------
WARNING:
	Some old and specific music starts with header 'YM2!', don't use this
	ID.
------------------------------------------------------------------------------






SPECIAL: Register 13 !
----------------------

	Creating a binary with YM registers for each VBL is easy. However
there is special case concerning register 13. Reg13 is used for the volume
envelope wave-form on the YM2149. The problem is writing to that register
"restarts" the wave-form at beginning. That is, you CAN'T access this regis-
ter each VBL if the original play-routine does not. So, if the original
player does not write to register 13 on VBL n, write 0xff value.
(So when YM.EXE read 0xff as reg13, the internal emulator register is not
updated).


That's all for 'YM3!' file.
---------------------------

	That's all for the 'YM3!' format. As you see, it is very simple (then
not very powerfull) but you can convert many atari soundchip tunes with that
format. (Especially old game-music, wich use very simple play-routine, or
AMSTRAD CPC music).

	But if you know the ATARI demos, you probably know there is many
tricks used by sound-player to produce real-drums or distorted sound: sample
for drums, additional tone synthesis using TIMER etc... The 'YM3!' format can
not play such music so...




NEW NEW NEW NEW NEW NEW NEW NEW NEW NEW NEW NEW NEW NEW NEW NEW NEW NEW NEW
---------------------------------------------------------------------------

	These days you can find many YM tunes on Internet World Wide Web. Many
of these are generated with automatic program. (See the ATARI program written
by Jochen Knaus). The problem is that for each music, the generating program
must know the music time. (And even the loop position if it exists !). So I
write a PC program (YMTOOL.EXE) wich:
	-Read an YM file.
	-Display infos about it.
	-Search loop automaticly in the music.
	-Save a new YM file with fine loop.

The new YM file supports the loop point to be at the middle of a music (not
only at the beginning, as the YM3 format). So a new format is born: "YM3b".
The only difference is "YM3b" instead of "YM3!" and the music file contains
one DWORD (32bits integers) at the end of the file, wich contains the frame
number at wich the loop restart.
Ex: If a music is 5600 frames and the loop restarts at frame 432, just write
"YM3b", then 5600*14 bytes of YM registers, then 432.

Go to my web-page to habe link to download YMTOOL.EXE or to find link to
Jochen Knaus homepage:

www.mygale.org/09/leonard/
